{include file="public/header" /}
<link rel="stylesheet" href="/static/index/css/draw.css">
<style>
    .layui-form-label{
        overflow: auto !important;
        padding: 0px !important;
        width: 95px !important;
        line-height: 38px;
    }
    .layui-form-label span{
        color: var(--rd);
    }
    .upimg div{
        width: 46% !important;
        height: 46% !important;
        display: block;
        margin-left: 8%;
        float: left;
    }
    .upimg div:first-child{
        margin-left: 0px !important;
    }   
    .upimg p{
        width: 100%;
        color: #aaa;
        line-height: 40px;
        float: left;
    }
   
</style>
<body class="hide-top bgc">
<div class="draw-container">
    <img src="/static/index/img/icon36.png" alt="">
    <div class="draw-content">
        <div class="earnings-content">
            <div class="earnings-hd flex-center">
                <i class="layui-icon layui-icon-left flex-center" onclick="history.go(-1)"></i>申请互助
            </div>
        </div>
        <div class="draw-account-news" style="margin-top: 3.75rem; padding-top: 2rem;">
            <form action="{:url('help/save')}" method="post" class="form layui-form">
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>姓名</label>
					<div class="layui-input-block">
						<input type="text" name="rname" placeholder="请填写姓名" value="{$info.rname??''}" lay-verify="required" class="layui-input"/>
					</div>
				</div>
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>性别</label>
					<div class="layui-input-block">
                        <input type="radio" name="sex" value="1" title="男" {if empty($info) || $info.sex == 1} checked {/if}>
                        <input type="radio" name="sex" value="2" title="女" {if !empty($info) && $info.sex == 2} checked {/if}>
					</div>
				</div>
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>身份证号码</label>
					<div class="layui-input-block">
                        <input type="text" name="idcard" value="{$info.idcard??''}" placeholder="请填写身份证号码" lay-verify="required" class="layui-input"/>
					</div>
				</div>
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>申请众筹金额</label>
					<div class="layui-input-block">
                        <input type="text" name="money" value="{$info.money??''}" placeholder="请填写申请众筹金额" lay-verify="required" class="layui-input"/>
					</div>
				</div>
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>本人户籍信息</label>
					<div class="layui-input-block upimg">
                        <div>
                            <img src="{$info.info_img?$info.info_img:'/static/index/img/addImg.png'}" alt="" id="info_img_show"  data-upid="#info_img_show" data-show="#info_img_show" data-value="#info_img" class="info_img_up">
                        </div>
                        <p>请上传户口本个人信息页</p>
                        <input type="hidden" name="info_img" id="info_img" value="{$info.info_img??''}" lay-verify="required"/>
					</div>
				</div>
                
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>入院证明</label>
					<div class="layui-input-block upimg">
                        <div>
                            <img src="{$info.hospital_in_img?$info.hospital_in_img:'/static/index/img/addImg.png'}" alt="" id="hospital_in_img_show"  data-show="#hospital_in_img_show" data-upid="#hospital_in_img_show" data-value="#hospital_in_img" class="info_img_up" >
                        </div>
                        <p>请上传入院证明</p>
                        <input type="hidden" name="hospital_in_img" id="hospital_in_img" value="{$info.hospital_in_img??''}" lay-verify="required"/>
					</div>
				</div>
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>诊断证明</label>
					<div class="layui-input-block upimg">
                        <div>
                            <img src="{$info.proof_img?$info.proof_img:'/static/index/img/addImg.png'}" alt="" id="proof_img_show" data-show="#proof_img_show" data-upid="#proof_img_show" data-value="#proof_img" class="info_img_up" >
                        </div>
                        <p>请上传诊断证明</p>
                        <input type="hidden" name="proof_img" id="proof_img" value="{$info.proof_img??''}" lay-verify="required"/>
					</div>
				</div>
                
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>医院报销证明</label>
					<div class="layui-input-block upimg">
                        <div>
                            <img src="{$info.health_img?$info.health_img:'/static/index/img/addImg.png'}" alt="" id="health_img_show" data-show="#health_img_show" data-upid="#health_img_show" data-value="#health_img" class="info_img_up" >
                        </div>
                        <p>请上传医院报销证明</p>
                        <input type="hidden" name="health_img" id="health_img" value="{$info.health_img??''}" lay-verify="required"/>
					</div>
				</div>
                <div class="layui-form-item">
					<label class="layui-form-label"><span>*</span>出院证明</label>
					<div class="layui-input-block upimg">
                        <div>
                            <img src="{$info.hospital_to_img?$info.hospital_to_img:'/static/index/img/addImg.png'}" alt="" id="hospital_to_img_show" data-show="#hospital_to_img_show" data-upid="#hospital_to_img_show" data-value="#hospital_to_img" class="info_img_up" >
                        </div>
                        <p>请上传出院证明</p>
                        <input type="hidden" name="hospital_to_img" id="hospital_to_img" value="{$info.hospital_to_img??''}" lay-verify="required"/>
					</div>
				</div>
                
                <div class="layui-form-item">
					<label class="layui-form-label">备注</label>
					<div class="layui-input-block">
                        <textarea name="note" placeholder="请输入备注" class="layui-textarea">{$info.note??''}</textarea>
					</div>
				</div>
                {if !empty($info) && $info->getData('status') == 3}
                <div class="layui-form-item" style="color: red !important;">
                    驳回理由：{$info.reject_msg}
                </div>
                {/if}
                <button  class="layui-btn save upd-save"  {if !empty($info) && ($info->getData('status') == 1 || $info->getData('status') == 2)} disabled {else} lay-submit lay-filter="save" formObj=".form" {/if}>申请互助</button>
                <div style="height: .1rem"></div>
            </form>
        </div>
    </div>
</div>
</body>
{include file="public/footer"/}
<script src="/static/index/js/clipboard.min.js"></script>
<script>
 layui.use(['form', 'layer', 'upload', 'laytpl'], function () {
    layer = layui.layer;
    form = layui.form;
    upload = layui.upload;
    laytpl = layui.laytpl;
    $('.upimg .info_img_up').click(function (e) {
        var uploadsimg = $(this).attr('data-upid'), show=$(this).attr('data-show'),valueId= $(this).attr('data-value');
        upload.render({
            elem: uploadsimg,
            url: '/index/uploads/uploadImage.html',
            before: function (obj) {
                layer.load(2);
                obj.preview(function (index, file, result) {
                    // $(".flex-center").show();
                    $(show).attr('src', result);
                    $(show).width('92px');
                    $(show).height('92px');
                });
            },
            done: function (res) {
                layer.closeAll();
                if (res.code == 200) {
                    layer.msg('上传成功');
                    $(valueId).val(res.data.url);
                } else {
                    return layer.msg('上传失败:' + res.msg);
                }

            },
            error: function () {
                return layer.msg('上传失败');
            }
        });
    })
});
function upimg(valueId,show,uploadsimg){
    console.log(111)
}
    function DataHtml(name, url) {
        $("#displayimg").attr("src", url);
        var height = $("#displayimg").height();
        var width = $("#displayimg").width();
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            shadeClose: true,
            area: [width + 'px', 'auto'], //宽高
            content: "<img style='width: 100%' alt=" + name + " title=" + name + " src=" + url + " />"
        });
    }
</script>
</html>